package org.bjf.springboot.service;

import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * Created by binjinfeng on 2017/3/6.
 */
@Service
public class EmailService {

  @Autowired
  private JavaMailSender mailSender;

  @Async
  public void asyncMail(String subject, String text) {
    SimpleMailMessage message = new SimpleMailMessage();
    message.setFrom("515109459@qq.com");
    message.setTo("binjinfeng@zhengzhibo.tv");
    message.setSubject("主题：" + subject);
    message.setText(text);
    mailSender.send(message);
  }


}
